package mygame;

import com.jme3.asset.AssetManager;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

/**
 * This class is a helper class for connecting the different nodes of the plane
 * together
 * @author aicher
 * @version 0.0.1
 */
public class MyPlane {
    /**
     * The Node will do alle the movements. All other elements are
     * attached to this planeNode. In order to avoid
     * too many methods (e.g. getter and setter) , this node is public
     */
    public Node planeNode = null;
    
    /**
     * Constant value for each plane according to the class "PlaneBehaviour". 
     */
    public int planeBehaviour = 0;
    
    /**
     * Holds the visible plane body model
     */
    private Spatial planeBody = null;
    
    /**
     * Constructor with all necessary values
     * @param assetManager For loading the assets
     * @param parentNode Here the plane node will be attached
     * @param modelDefinition String holding the adress of the model definition
     * @param initialPlaneLocation Start location of the plane node
     * @param planeBehaviour For getting the corrrect behaviour values from the 
     * Class "PlaneBehaviour"
     */
    public MyPlane(
            AssetManager assetManager,
            Node parentNode,
            String modelDefinition,
            Vector3f initialPlaneLocation,
            int planeBehaviour) {
        this.planeBehaviour = planeBehaviour;
        this.planeBody = assetManager.loadModel(modelDefinition);
        
        this.planeNode = new Node();
        this.planeNode.setLocalTranslation(initialPlaneLocation);
        this.planeNode.attachChild(planeBody);
        parentNode.attachChild(this.planeNode);
    }

}
